package cn.yunhe.controller;

import cn.yunhe.pojo.ResultRequest;
import cn.yunhe.pojo.ResultResponse;
import cn.yunhe.pojo.UserInfo;
import cn.yunhe.service.IUserInfoService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/userInfo")
public class UserInfoController {

    @Autowired
    IUserInfoService userInfoService;

    @RequestMapping("/queryAll")
    public ResultResponse queryAll(@RequestBody ResultRequest resultRequest){
        List<UserInfo> userInfoList = userInfoService.queryAll(resultRequest);
        ResultResponse resultResponse = new ResultResponse();
        resultResponse.setData(userInfoList);
        resultResponse.setCount(new PageInfo(userInfoList).getTotal());
        return  resultResponse;
    }
}
